package ptaweek9;

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main6
{
    public static void main(String[] args) 
    {
       Scanner sc=new Scanner(System.in);
       Queue<Integer> A=new ArrayDeque<Integer>();
       Queue<Integer> B=new ArrayDeque<Integer>();
       int n=sc.nextInt();
       for(int i=0;i<n;i++){
    	   int a=sc.nextInt();
    	   if(a%2==0)
    		  B.offer(a);
    	   else
    		   A.offer(a);
       }
       int flage=1;
       while(A.size()!=0&&B.size()!=0){
    	  if(flage==1){
    		  System.out.print(A.poll());
    		  flage=0;
    	  }
    	  else
    		  System.out.print(" "+A.poll());
    	  if(flage==1){
    		  System.out.print(A.poll());
    		  flage=0;
    	  }
    	  else
    		  System.out.print(" "+A.poll());
    	  if(flage==1){
    		  System.out.print(B.poll());
    		  flage=0;
    	  }
    	  else
    		  System.out.print(" "+B.poll());
       }
       while(A.size()!=0)
    	   if(flage==1){
     		  System.out.print(A.poll());
     		  flage=0;
     	  }
     	  else
     		  System.out.print(" "+A.poll());
       while(B.size()!=0)
    	   if(flage==1){
     		  System.out.print(B.poll());
     		  flage=0;
     	  }
     	  else
     		  System.out.print(" "+B.poll());
     }
}
